//
//  LVSlideCell.m
//  LEVE
//
//  Created by 上官惠阳 on 2017/3/3.
//  Copyright © 2017年 dashuju. All rights reserved.
//

#import "LVSlideCell.h"
#import "HYDoubleSlideView.h"

@implementation LVSlideCell
- (void)awakeFromNib
{
    [super awakeFromNib];
    self.selectionStyle = UITableViewCellSelectionStyleNone;

    _slideView = [[HYDoubleSlideView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth - 2*_slideBackView.left, _slideBackView.height)];
    [_slideBackView addSubview:_slideView];
}
- (void)layoutSubviews
{
    [super layoutSubviews];

}
- (void)setSlideType:(LVSlideType)slideType
{
    _slideType = slideType;
    switch (slideType) {
        case LVAgeSlide:
        {
            _slideView.isDouble = YES;
            _slideView.minValue = 18;
            _slideView.maxValue = 65;
            _slideView.maxTintColor = KGrayColor;
            _slideView.mainTintColor = KMainColor;
            _slideView.minTintColor = KGrayColor;
            _slideView.currentMinValue = 18;
            _slideView.currentMaxValue = 40;

            _slideTypelable.text = @"年龄范围选择";
            _slideValueLabel.text =  [NSString stringWithFormat:@"%.f-%.f",_slideView.currentMinValue,_slideView.currentMaxValue];
            WeakSelf(weakSlef);
            _slideView.changeValueBlock = ^(CGFloat min,CGFloat max){
                weakSlef.slideValueLabel.text = [NSString stringWithFormat:@"%.f-%.f",min,max];
            };

            _startImgView.image = [UIImage imageNamed:@"manage_hat"];
            _endImgView.image = [UIImage imageNamed:@"manage_sofa"];
        }
            break;
        case LVDistanceSlide:
        {
            _slideView.isDouble = NO;
            _slideView.minValue = 0;
            _slideView.maxValue = 1000;
            _slideView.mainTintColor = KGrayColor;
            _slideView.minTintColor = KMainColor;
            _slideView.currentMinValue = 500;
            _slideValueLabel.text = [NSString stringWithFormat:@"%.fkm",_slideView.currentMinValue];

            _slideTypelable.text = @"距离范围选择";
            WeakSelf(weakSlef);
            _slideView.changeValueBlock = ^(CGFloat min,CGFloat max){
                weakSlef.slideValueLabel.text = [NSString stringWithFormat:@"%.fkm",min];
            };

            _startImgView.image = [UIImage imageNamed:@"bike"];
            _endImgView.image = [UIImage imageNamed:@"aircraft"];
        }
            break;
        default:
            break;
    }
}
@end
